# 初始化解析器
from pathlib import Path

from core.book_parser import BookParser
from core.file_manager import FileManager
from core.vocab_processor import VocabularyProcessor

parser = BookParser(Path("../books/Gone Girl (Gillian Flynn) (Z-Library).epub"))
parser.validate_and_load()

# 处理指定章节
chapters = parser.extract_chapters({"AMY ELLIOTT", "Epilogue"})

# 初始化处理器
processor = VocabularyProcessor()

# 加载已知词汇
known_words = FileManager.load_known_words()  # 自定义函数

# 生成结果
results = processor.process_book(chapters[0-1], known_words)

# 保存输出
FileManager.save_vocabulary(results, "novel_vocab.xlsx")  # 自定义函数